package com.jt.tenant.dialog;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.jt.tenant.R;
//import com.jt.tenant.activity.FillFreeWayInfoAcitity;
//import com.jt.tenant.activity.NewInsCarInfoActivity;
//import com.jt.tenant.activity.NewInsQuoteActivity;
//import com.jt.tenant.activity.NewInsSupInfoActivity;
//import com.jt.tenant.activity.NewSelectInsTypeActivity;
//import com.jt.tenant.activity.NewVCISelectActivity;
//import com.jt.tenant.activity.UpPictureActivity;
//import com.jt.tenant.app.JTApplication;
//import com.jt.tenant.conn.SetNewInsOrder;
//import com.jt.tenant.conn.SetNewInsSUP;

import java.io.Serializable;

/**
 * Created by Administrator on 2016/4/25.
 */
public class ResultDialog extends JTDialog implements View.OnClickListener, Serializable {

    private TextView tv_cancel, tv_submit, tv_message;

    private Intent intent;

    private Context mContext;

    private String name = "A";

//    private SetNewInsOrder.Info info = new SetNewInsOrder.Info();
//
//    private SetNewInsSUP.Info info1 = new SetNewInsSUP.Info();

    public ResultDialog(Context context) {

        super(context);

        setContentView(R.layout.dialog_result);

        mContext = context;

        initView();

    }

    private void initView() {


        tv_message = (TextView) findViewById(R.id.id_message);

        (tv_submit = (TextView) findViewById(R.id.id_confirm)).setOnClickListener(this);

    }

    public void setTip(String name) {

        try {

            tv_message.setText(name);

        } catch (Exception e) {
        }

    }

    public void setActivity(String name) {

        this.name = name;

    }

//    public void setInfo(SetNewInsOrder.Info info) {
//
//        this.info = info;
//
//    }
//
//    public void setInfo1(SetNewInsSUP.Info info) {
//
//        this.info1 = info;
//
//    }


    @Override
    public void onClick(View v) {

        switch (v.getId()) {

            case R.id.id_confirm:

                this.dismiss();

                if (!this.name.equals("A")) {

                    Intent intent = null;
                    try {
                        intent = new Intent(mContext, Class.forName(name));
                    } catch (ClassNotFoundException e) {
                        e.printStackTrace();
                    }

//                    if (name.equals("com.jt.tenant.activity.NewWaitQuoteActivity")) {
//
//                        intent.putExtra("info", info);
//
//                        JTApplication.INSTANCE.finishActivity(NewVCISelectActivity.class, NewSelectInsTypeActivity.class, NewInsCarInfoActivity.class);
//
//                    } else if (name.equals("com.jt.tenant.activity.NewWaitPricingActivity")) {
//
//                        intent.putExtra("info", info1);
//
//                        JTApplication.INSTANCE.finishActivity(NewInsQuoteActivity.class, NewInsSupInfoActivity.class);
//
//                    } else if (name.equals("com.jt.tenant.activity.MainActivity")) {
//
//                        intent.putExtra("id", "4");
//
//                        JTApplication.INSTANCE.finishAllActivity();
//
//                    } else if (name.equals("com.jt.tenant.activity.PersonActivity")) {
//
//                        JTApplication.INSTANCE.finishActivity(FillFreeWayInfoAcitity.class, UpPictureActivity.class);
//
//                    }

                    mContext.startActivity(intent);

                    this.dismiss();

                } else {

                    this.dismiss();

                }

                break;

        }

    }
}
